feat(go): expand Go slop pattern coverage#24
Merged
Conversation
Add comprehensive Go-specific pattern coverage:
- go_fmt_debugging: fmt.Print/Println/Printf in production code
- go_log_debugging: log.Print/Fatal/Panic standard library calls
- go_spew_debugging: spew/pp debug dumping libraries
- go_empty_error_check: silently swallowed errors (if err != nil {})
- go_discarded_error: errors discarded via blank identifier
- go_bare_os_exit: os.Exit() in non-main code
- go_empty_interface_param: empty interface{} parameters
- go_todo_empty_func: functions with only TODO/FIXME comments
Total Go patterns: 9 (1 existing + 8 new)
Add golangci-lint integration for Phase 2 deep analysis: - Runs golangci-lint with JSON output and arg array (no shell) - Maps severity levels (error->high, warning->medium, info->low) - Returns null if tool unavailable, [] on parse failure - 120s timeout for large codebases
Wire up runGolangciLint() in runPhase2() after the escomplex block. Findings use patternName 'golangci_lint_issue' with LOW certainty.
Coverage for all 9 Go patterns with: - Integration tests: hasLanguage, getPatternsForLanguageOnly count, pattern name presence, required fields validation - Per-pattern blocks with true positives, false positives, and file exclusion tests - Key false positive guards: go_discarded_error vs range iteration, go_fmt_debugging vs test files
The **/cmd/** glob requires a directory prefix and does not match cmd/ at the repository root. Add cmd/** alongside **/cmd/** for go_fmt_debugging, go_log_debugging, and go_bare_os_exit patterns.
- Limit [^)]* to {0,200} in go_todo_empty_func and go_empty_interface_param
- Limit (?:\.\w+)* to {0,10} in go_discarded_error
- Add targetFiles filtering to runGolangciLint
- Add edge case tests for named returns and variadic params
70b7b7b to
09d1ce6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
placeholder_panic_go)runGolangciLint()CLI enhancer for Phase 2 pipeline integrationNew Go Patterns
go_fmt_debugginggo_log_debugginggo_spew_debugginggo_empty_error_checkgo_discarded_errorgo_bare_os_exitgo_empty_interface_paramgo_todo_empty_funcAlso includes
Test Plan
npm test)Closes #4